package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.CodeEndBytecodeEvent;

public class CodeEndBytecodeEventImpl extends BytecodeEventImpl implements CodeEndBytecodeEvent
{
    private int maximumStackSize;
    private int maximumLocalVariables;

    public CodeEndBytecodeEventImpl(final int aMaximumStackSize, final int aMaximumLocalVariables) {
        maximumStackSize = aMaximumStackSize;
        maximumLocalVariables = aMaximumLocalVariables;
    }

    @Override
    public int getType() {
        return CODE_END;
    }

    @Override
    public void setMaximumStackSize(final int aMaximumStackSize) {
        maximumStackSize = aMaximumStackSize;
    }

    @Override
    public int getMaximumStackSize() {
        return maximumStackSize;
    }

    @Override
    public void setMaximumLocalVariables(final int aMaximumLocalVariables) {
        maximumLocalVariables = aMaximumLocalVariables;
    }

    @Override
    public int getMaximumLocalVariables() {
        return maximumLocalVariables;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitCodeEnd(this);
        return aBytecodeVisitor;
    }
}
